package org.weso.desempleo.to;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


@XmlRootElement(name = "observationStatsTO")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(name = "observationStatsTO", propOrder = {
    "label", "less25", "between2545", "more45", "type"
})
public class ObservationStatsTO {

	private String label;
	private int less25;
	private int between2545;
	private int more45;
	private String type;
	
	private final String menor_es = "Menor de 25";
	private final String menor_en = "Less than 25";
	private final String entre_es = "Entre 25 y 45";
	private final String entre_en = "Between 25 and 45";
	private final String mas_es = "45 años o mas";
	private final String mas_en = "45 years or more";
	
	public ObservationStatsTO(String period) {
		this.label = period;
		less25 = between2545 = more45 = 0;
		type = "Observation";
	}
	
	
	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getLess25() {
		return less25;
	}

	public void setLess25(int less25) {
		this.less25 = less25;
	}

	public int getBetween2545() {
		return between2545;
	}

	public void setBetween2545(int between2545) {
		this.between2545 = between2545;
	}

	public int getMore45() {
		return more45;
	}

	public void setMore45(int more45) {
		this.more45 = more45;
	}
	
	public ObservationStatsTO() {
		type = "Observation";
	}

	public void addUnemployment(int unemployment, String age) {
		if(age.equals(menor_es) || age.equals(menor_en)) {
			less25 += unemployment;
		} else if(age.equals(entre_es) || age.equals(entre_en)) {
			between2545 += unemployment;
		} else if(age.equals(mas_es) || age.equals(mas_en)) {
			more45 += unemployment;
		}
	}
	
	
}
